package com.cy.pj.controller;

import com.cy.module.pojo.RequestParameter;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class ParamObjectController {
    @RequestMapping("/doParam01")
    public String doMethodParam(String name){
        return "request params "+name;
    }
    @RequestMapping("/doParam03/{id}")
    public String doMethodParam03(@PathVariable Integer id){
        return "request params "+id;
    }
    @RequestMapping("/doParam04")
    public String doMethodParam(RequestParameter pojo){//pojo对象接收请求参数,pojo对象中需提供与参数名相匹配的set方法
        return "request params "+pojo.toString();
    }
    @RequestMapping("/doParam05")
    public String doMethodParam(@RequestParam Map<String,Object> param){
        return "request params "+param.toString();
    }
}
